import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { BusiProvider } from '../../providers/busi/busi';

/**
 * Generated class for the UsersPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-users',
  templateUrl: 'users.html',
})
export class UsersPage {
  userlist:any;
  constructor(public navCtrl: NavController, public navParams: NavParams,public busi:BusiProvider) {
    this.getAllUser();
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad UsersPage');
  }

  getAllUser(){
    this.busi.getAllUsers().subscribe(
      data=>{
        this.userlist = data.allusers;
      },
      err=>{

      }
    );
  }

  userdeatil(user){
    this.navCtrl.push("UserdetailPage",{user:user})
  }

}
